package STUDENT.TRANDAODAIVI.BASIC.BaiTapCauTruc;
import java.util.InputMismatchException;
import java.util.Scanner;

public class BT2 {
public static void main(String[] args) {
	Scanner input=new Scanner(System.in);
	System.out.println("          Calculation");
	
	//input
	try{
	System.out.print("Nhap a: ");
	double a=input.nextDouble();
	System.out.print("Nhap b: ");
	double b=input.nextDouble();
	System.out.print("Nhap phep tinh toan giua a va b: ");
	input=new Scanner(System.in);
	String phep=input.nextLine();
	String Cong,Tru,Nhan,Chia;
	switch (phep){
		case "Cong": System.out.println("Ket qua: "+(a+b));break;
		case "Tru" : System.out.println("Ket qua: "+(a-b));break;
		case "Nhan": System.out.println("Ket qua: "+(a*b));break;
		case "Chia": if (a!=0&&b==0){System.out.println("Khong the chia cho 0");}
		else if (a==0&&b==0){System.out.println("Khong the xac dinh");}
		else {System.out.println("Ket qua: "+a/b);}
	}
	}
	catch(InputMismatchException exc){
		System.out.println("Ban chi duoc nhap so cho a va b");
	}
	
	
}
}
